const https = require('https');
const fs = require('fs');
const path = require('path');

// 生成证书的路径
const options = {
    key: fs.readFileSync(path.join(__dirname, 'key.pem')), // 私钥
    cert: fs.readFileSync(path.join(__dirname, 'cert.pem')), // 证书
};

// 创建 HTTPS 服务器
https.createServer(options, (req, res) => {
    res.writeHead(200);
    res.end('Hello, HTTPS!\n');
}).listen(5173, () => {
    console.log('HTTPS Server running at https://localhost/');
});